package com.atguigu01.use.exer2;

import org.junit.Test;

import javax.imageio.metadata.IIOMetadataFormatImpl;
import javax.swing.text.StyledEditorKit;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.function.Predicate;

/**
 * ClassName: Answer
 * Package: com.atguigu01.use.exer2
 * Description:
 *
 * @Author BuTang
 * @Create 2023/6/10 15:18
 * @Version 1.0
 */
public class Answer {
    @Test
    public void test1(){
    ArrayList<Integer> arrayList = new ArrayList<>();

        for (int i = 0;  arrayList.size() < 5; i++) {
            int j = (int) (Math.random() * 101);
            arrayList.add(j);
        }
        for (Object obj:arrayList
             ) {
            System.out.println(obj);
        }
        System.out.println("---------------");
        arrayList.removeIf(new Predicate<Integer>() {
            @Override
            public boolean test(Integer integer) {
                return integer % 2 ==0;
            }
        });

        Iterator iterator = arrayList.iterator();
        while (iterator.hasNext()) System.out.println(iterator.next());


        }
    }



